package com.starry.home.ui.mine

import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import com.starry.core.base.BaseActivity
import com.starry.core.ext.singleClick
import com.starry.core.utils.GlideUtils
import com.starry.home.R
import com.starry.home.databinding.ActivityHealthRecordBinding
import com.starry.home.logic.model.login.UserInfoBean
import com.starry.home.viewmodel.mine.HealthRecordViewModel

/**
 * Package:com.starry.home.ui.mine
 * Author:starr
 * Time:2024/4/29 11:03
 * Description: 健康档案
 */
class HealthRecordActivity : BaseActivity<ActivityHealthRecordBinding, HealthRecordViewModel>() {


    companion object {
        private lateinit var userInfo: UserInfoBean

        fun startAction(context: Context, bundle: Bundle) {
            val intent = Intent(context, HealthRecordActivity::class.java)
            userInfo = ((bundle.getSerializable("userInfo") as UserInfoBean?)!!)
            context.startActivity(intent)
        }
    }

    override fun initData() {

    }

    @SuppressLint("SetTextI18n")
    override fun initView() {
        mDataBinding.titleTopBar.baseTvTitle.text = "健康档案"
        mDataBinding.titleTopBar.baseIvBack.setOnClickListener {
            finish()
        }
        mDataBinding.titleTopBar.baseIvBack.visibility = View.VISIBLE

        GlideUtils.loadImage(getContext(), userInfo.emrHzImg, mDataBinding.ivUser)
        mDataBinding.tvUser.text = userInfo.emrHzName
        mDataBinding.tvAge.text =
            userInfo.emrHzAge.toString() + "岁" + " | " + userInfo.emrHzSex + " | " + userInfo.emrHzMarry

        mDataBinding.tvBmi.singleClick {
            BMIActivity.startAction(getContext())
        }
    }

    override fun getLayoutId() = R.layout.activity_health_record
}